package org.pjsip.pjsua2;

import android.util.Log;

import com.blankj.utilcode.util.StringUtils;

import org.pjsip.bean.SipResponse;
import org.pjsip.iface.OnSipStatusChangedListener;

/**
 * author : GWFan
 * time   : 1/20/21 2:29 PM
 * desc   :
 */

public class MySipPhoneEvent extends PhoneEvent {
    private static final String TAG = "MySipPhoneEvent";
    public static OnSipStatusChangedListener onSipStatusChangedListener;

    public static void setOnSipStatusChangedListener(OnSipStatusChangedListener listener) {
        onSipStatusChangedListener = listener;
    }

    @Override
    public void msg(String date, String type, int code, String msg) {
        Log.d(TAG, "msg: ---------->"+type);
        if (onSipStatusChangedListener != null) {
            SipResponse sipResult = new SipResponse();
            sipResult.setCode(code);
            sipResult.setDate(date);
            sipResult.setType(type);
            sipResult.setMsg(msg);
            onSipStatusChangedListener.onSipStatusChanged(sipResult);
        }
    }
}

